﻿$(document).ready(function() {
    $("form.delete-link").css("display", "none");
    $("a.delete-link").show();
    $("a.delete-link").live('click', function(ev) {
        ev.preventDefault();
        $(this).prev("form.delete-link").children("input:submit").click();
    });
    $("input.datepicker").datepicker();

    //
    $('.form input, .form textarea, .form select').focus(function() {
        $(this).addClass('field-on');
        //if (!$(this).hasClass('hex') && $(this).attr('id') != 'id_url') {
        //$(this).css('background', '#fff')
        //}
        $(this).animate({ backgroundColor: "#d2e8fd" }, 500)
                    .animate({ backgroundColor: "#ffffff" }, 500);

    }).blur(function() {
        $(this).removeClass('field-on');
        //$(this).animate({ backgroundColor: "#ffffff" }, 500);
    });

    $(function() {
        $(".datepicker").datepicker();
    });


});


var ajaxBegin = function(args) {
    $(args.$4).fadeOut("normal");
}

var ajaxSuccess = function(args) {
    var div = args.$4;
    $(div).fadeIn("normal");

    //redo doc ready for the new div
    $("#" + elemId + " form.delete-link").css("display", "none");
    $("#" + elemId + " a.delete-link").show();
    $("#" + elemId + " input.datepicker").datepicker();
}

var ajaxFailure = function(args) {
    alert("Call Failed");
}

